Repository navigation
fix: surface unrouted / unrecognized-path requests instead of going silent (#1290) - #1291
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1291Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1291.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review of PR #1291 — reviewed against current master ( ① Original issue (direction gate)#1290's root cause was established in triage: protocol detection is path-suffix tables on both ends (client ② Regression review (existing behaviors touched)Walked every direct-send path through the patched fetch and every surface the diff touches:
All disclosed behavior changes match the code exactly (client: silent direct → once-per-process-per-endpoint log, ≤256 distinct; stats: + ③ Code review — two findings, both fixed directly on the branchF1 (fixed, commit F2 (fixed, commit Otherwise clean: stats keys use query-stripped + ④ Test validity
⑤ Diff cleanliness8 files, +115/−5, every line serves the PR's purpose; the single import-line conflict was resolved by union correctly; no whitespace churn, no lockfile/generated churn. My two follow-up commits are small and separately labeled. Verification (re-run after my fixes)
Verdict: mergeable once CI goes green — human merges. P2 (custom-wire compression) remains an open decision in #1290; nothing here precludes any of the three options. 中文摘要:审查了本 PR(让未识别端点"直连不压缩"不再静默),方向和实现都正确;直接在分支上补了两个小修——①钩子误把 bili 自身控制面 URL( |
[bot] 🏷 CI confirmed green on head Verdict stands: ready for human merge. P2 (custom-wire compression) remains an open decision in #1290. 中文摘要:CI 全绿(含两个审查补修提交),本 PR 可合并。 |
…ilent (#1290) A request whose path matches no known wire protocol (e.g. a third-party plugin's custom wire such as commandcode's Go plan POST /alpha/generate) was relayed byte-for-byte with ZERO signal — neither compression nor any explanation. That contradicts the #1158 "tell me why it didn't compress" promise and the #897 loud-not-silent principle. Make both ends loud. Client (native-intercept + dsh-native): - New optional NativeInterceptState.onUnroutedModelUrl hook, fired for every request the fetch patch lets through WITHOUT routing because its URL misses isModelApiUrl. Undefined hosts stay silent (no behavior change for others). - dsh wires it to log each distinct unrouted endpoint once per process via console.error + persistClientEvent (the durable channel GUI hosts need), bounded at 256 distinct endpoints like gateRefusals. Proxy (server/observability + server + acp-status): - getUnrecognizedPathStats() aggregates the existing per-path warn map. - /__bili/stats gains an `unrecognizedPaths` field (count + per-path counts). - acp_status gains an "UNRECOGNIZED PATHS (instance-level)" section while such requests exist, mirroring the UNDECRYPTED TRAFFIC section. Docs: README troubleshooting section explaining the limitation + the new signals + the workaround (use the provider's standard protocol endpoint). Behavior change (intended): non-model-API URLs previously went direct silently; each such endpoint now logs once per process. /__bili/stats and acp_status gain additive fields/sections. No existing threshold/default/timing/output-format changed. This does NOT make custom wires compressible — that is a separate feature (custom request/response codec + config seam) pending owner decision. Regression tests: native-intercept (hook fires for a custom wire, not for a routed model endpoint) + dump-observability (per-path counts exposed).
813e126 to
41ebbdb
Compare
…cp_status + panel Custom-wire endpoints (e.g. TRAE llm_utils_chat / Qoder sash agent_chat_generation) go DIRECT at the host and never reach the proxy, so the server-side unrecognizedPaths stat (#1290/#1291) is blind to them. Add a host->proxy report (/__bili/plugin/unrouted, fire-and-forget on first sighting of each distinct endpoint) and surface the set where users already look: the acp_status/compress unknown-conversation 404 now NAMES the endpoints instead of staying generic, and the web panel shows a dedicated banner. Pure diagnostics: no compression behavior, threshold, default, data-format, or config change. Inputs bounded (per-path length + count cap); latest report wins per agent.
What & why
#1290: with dsh + thedsh-commandcode-providerplugin's Go plan, model calls go to a custom wire (POST /alpha/generate) whose path matches none of bili's known protocol suffixes. bili relayed those bytes through and compressed nothing — and told the user nothing, contradicting the #1158 "tell me why it didn't compress" promise and the #897 loud-not-silent principle.This PR makes that outcome loud at both ends so a user can see why a request wasn't compressed instead of guessing. It does not make the custom wire compressible (that is a separate feature — see below).
Changes
Client side (was the silent direct-connect gate):
src/agent/native-intercept.ts: new optionalNativeInterceptState.onUnroutedModelUrl(url)hook, fired for every request the fetch patch lets through without routing because its URL missesisModelApiUrl. Undefined hosts stay silent → zero behavior change for other clients.src/agent/dsh-native.ts: wires the hook to log each distinct unrouted endpoint once per process viaconsole.error+persistClientEvent(the durable channel GUI hosts need), bounded at 256 distinct endpoints like the existinggateRefusals.Proxy side (was warn-3-times-then-silence):
src/server/observability.ts:getUnrecognizedPathStats()aggregates the existing per-path warn map.src/server.ts:/__bili/statsgains anunrecognizedPathsfield (total + per-path counts).src/acp-status.ts:acp_statusgains anUNRECOGNIZED PATHS (instance-level)section while such requests exist, mirroring the existingUNDECRYPTED TRAFFICsection.Docs: README troubleshooting section explaining the limitation, the three new signals, and the workaround (use the provider's standard protocol endpoint — Command Code's Provider plan posts to
/provider/v1/chat/completions, which does compress).Behavior change (intended, flagged per house rule)
/__bili/stats{ sessions, blindTunnels }unrecognizedPathsacp_statusUNRECOGNIZED PATHSsection only when count > 0Additive only — no threshold/default/timing/existing-output-format changed; no fallback or default value changed.
Not done here (P2 — needs owner decision)
Actually compressing a custom wire requires a new codec (request decoder from the CLI envelope
params.messages+ JSONL response decoder) plus a config seam to declare a 5th wire. That touches BOTH compression modes' wire/message shape and the config schema → stays a human-scoped feature per §7.4. Recommended interim: the loud signal (this PR) + the Provider-plan workaround.Pre-flight (rebased onto current master 8e5eb58)
npm run typecheck— cleannpm run build— success (+dist-import-annotations: OK)npm test— 2494 pass / 0 fail / 9 skipped (skips are env-gated claude-native e2e behindACP_TEST_CLAUDE_NATIVE)tests/native-intercept.test.ts(hook fires for a custom wire, not for a routed model endpoint) +tests/dump-observability.test.ts(per-path counts exposed).Rebased onto current master; single conflict in the
src/server.tsimport line resolved by union (kept upstream's newoutput-steeringimport + this change'sgetUnrecognizedPathStats).Partially addresses #1290.